﻿using System;
using Eassets.Data.Asset;
using Eassets.Layered.Domain.Asset;
using System.Collections.ObjectModel;

namespace Eassets.Service.Asset
{
    public class AssetItemDetailsService
    {
        AssetItemDetailsData assetItemDetailsdata = new AssetItemDetailsData();

        /// <summary>
        /// Inserts assetItemDetails.
        /// </summary>
        /// <param name="assetItemDetails"></param>
        public void AddAssetItemDetails(AssetItemDetails assetItemDetails)
        {
            if (assetItemDetails != null)
            {
                assetItemDetailsdata.AddAssetItemDetails(assetItemDetails);
            }
        }

        /// <summary>
        /// Updates assetItemDetails.
        /// </summary>
        /// <param name="assetItemDetails"></param>
        public void ModifyAssetItemDetails(AssetItemDetails assetItemDetails)
        {
            if (assetItemDetails != null)
            {
                assetItemDetailsdata.ModifyAssetItemDetails(assetItemDetails);
            }
        }

       /// <summary>
        /// Updates assetItemDetails.
       /// </summary>
       /// <param name="assetItemDetails"></param>
        public void UpdateAssetItemDetailsStatus(AssetItemDetails assetItemDetails)
        {
            if (assetItemDetails != null)
            {
                assetItemDetailsdata.UpdateAssetItemDetailsStatus(assetItemDetails);
            }
        }

        /// <summary>
        /// Delete assetItemDetails.
        /// </summary>
        /// <param name="assetItemDetailsId"></param>
        public void DeleteAssetItemDetails(long assetItemDetailsId)
        {
            if (assetItemDetailsId != 0)
            {
                assetItemDetailsdata.DeleteAssetItemDetails(assetItemDetailsId);
            }
        }

        /// <summary>
        /// GetbyId assetItemDetails.
        /// </summary>
        /// <param name="assetItemDetailsId"></param>
        /// <returns></returns>
        public AssetItemDetails GetByIdAssetItemDetails(long assetItemDetailsId)
        {
            return assetItemDetailsdata.GetByIdAssetItemDetails(assetItemDetailsId);
        }

        /// <summary>
        /// GetAll assetItemDetails.
        /// </summary>
        /// <returns></returns>
        public Collection<AssetItemDetails> GetAllAssetItemDetails()
        {
            return assetItemDetailsdata.GetAllAssetItemDetails();
        }

        public Collection<AssetItemDetails> GetAssetRegistryDetails()
        {
            return assetItemDetailsdata.GetAllAssetItemDetails();
        }

        public String GetLastItemSerial(long assetId)
        {
            return assetItemDetailsdata.GetLastItemSerial(assetId);
        }

        public void UpdateAssetItemDetailsWithCurrentBookValueAndRemLifeTime(AssetItemDetails assetItemDetails)
        {
            assetItemDetailsdata.UpdateAssetItemDetailsWithCurrentBookValueAndRemLifeTime(assetItemDetails);
        }

        public Collection<AssetItemDetails> GetFixedAssetItemDetailsByAssetId(long assetId)
        {
            return assetItemDetailsdata.GetAssetItemDetailsByAssetId(assetId);
        }

        public Collection<AssetItemDetails> GetAllAssetItemDetailsByOrganizationLevelListId(long organizationLevelListId, long assetId)
        {
            return assetItemDetailsdata.GetAllAssetItemDetailsByOrganizationLevelListId(organizationLevelListId, assetId);
        }

        public void UpdateCustodian(AssetItemDetails assetItemDetails)
        {
            assetItemDetailsdata.UpdateCustodian(assetItemDetails);
        }
    }
}
